-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node 16 upgrade and peer dependency cleanup #250
Conversation
65dd2b5
to
7b696a3
Compare
8344c30
to
f0e21f4
Compare
Codecov Report
@@ Coverage Diff @@
## master #250 +/- ##
==========================================
- Coverage 76.31% 75.90% -0.41%
==========================================
Files 33 33
Lines 591 606 +15
Branches 137 152 +15
==========================================
+ Hits 451 460 +9
- Misses 126 132 +6
Partials 14 14
Continue to review full report at Codecov.
|
.github/workflows/ci.yml
Outdated
npm whoami | ||
- name: Install and Setup Dependencies | ||
run: | | ||
npm install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting we need to run two install commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first is installing node modules at the root directory (e.g, to install Lerna itself).
The second is to run npm install in all packages. So technically it's 4 installs 🤪
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I see, makes sense now, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more the (merrier) 🤣
* Move "globally" installed dependencies from root to each individual package, as needed. * Ensure all peer dependencies include a semver range, on their current versions.
* Updates jest and eslint config to adhere to local package aliases. * Formally adopts NPM workspaces. * Deletes node_modules in the `clean` Makefile targets
c5e4a19
to
80c581e
Compare
- name: Setup Nodejs | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This repository is now relying on NPM workspaces. As such, it is not compatible with Node 12 or Node 14, as NPM workspaces require npm
v7+, so we will only run against Node 16.
git switch -c "actual-branch-not-detached-head" | ||
lerna version --allow-branch actual-branch-not-detached-head --no-git-tag-version --no-changelog --no-push --yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By changing the on
from "push" to "pull_request" ensures this workflow is only run when necessary, but in doing so, the checkout is in a detached HEAD
state, so we need to force switch to an attached branch for the version dry-run command to work.
BREAKING CHANGE: The Open edX platform is collectively moving towards Node 16. By doing so in this repository, we can now use NPM workspaces in place of Lerna in many places. Lerna is still used for publishing to NPM, updating CHANGELOGs and package.json files upon released. But NPM workspace commands can now be used instead of Lerna commands for the developer experience, which is more performant, easier to reason about, and natively supported by NPM.
.github/workflows/ci.yml
Outdated
# pulls all commits (needed for lerna / semantic release to correctly version) | ||
fetch-depth: 0 | ||
# pulls all tags (needed for lerna / semantic release to correctly version) | ||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious as to why this run directive is the start of it's own sequence and not part of the "Checkout" sequence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can combine run
in the same sequence that has a uses
. I attempted to move the run
directive in the "Checkout" sequence but the CI workflow wasn't running due to an incorrect configuration. I moved it back to its standalone step, but gave it a name, too.
Description
npm install
on Node 16+.package.json
were instead distributed to each individual package as necessary. The tradeoff is we lose having a single source-of-truth of common "global" dependencies like@edx/frontend-platform
, but this is OK and was a premature optimization (i.e., we only have 3 packages)..nvmrc
to include16
🎉lerna bootstrap
, which is a command that is a little magical ✨:package-lock.json
, and creating symlinks between packages in this monorepo to allow importing by the module name, e.g.import { useEnterpriseConfig } from '@edx/frontend-enterprise-utils';
.npm install
ourselves vialerna exec -- npm install
to avoid this symlinking wizardry altogether 🧙I think this also may be a step towards using NPMAdopts NPM workspaces! 😄workspaces
in the future?Testing
Using
@edx/frontend-enterprise-utils
via amodule.config.js
override infrontend-component-header-edx
seemingly led to good results (related PR):Additionally, all 3 packages (
@edx/frontend-enterprise-utils
,@edx/frontend-enterprise-catalog-search
, and@edx/frontend-enterprise-logistration
) are used byfrontend-app-admin-portal
. In a test viamodule.config.js
, the application seems to run no problem 💪The Other stuff
Merge checklist:
frontend-app-learner-portal-enterprise
,frontend-app-admin-portal
, andfrontend-app-enterprise-public-catalog
). Will consumers safely be able to upgrade to this change without any breaking changes?BREAKING CHANGE
so the NPM package is released as such.Post merge:
chore(release): publish
) that incremented versions in relevant package.json and CHANGELOG files, and created Git tags for those versions.Publish from package.json
Github Action workflow to publish these new package versions to NPM.master
branch.npm view <package_name> versions --json
).